package cn.ylz.ylmall.product.dao.persist.repository.impl;

import cn.ylz.ylmall.product.dao.persist.mapper.PCommentDetailMapper;
import cn.ylz.ylmall.product.dao.persist.repository.IPCommentDetailRepository;
import cn.ylz.ylmall.product.pojo.entity.PCommentDetail;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class PCommentDetailRepositoryImpl implements IPCommentDetailRepository {
    @Autowired
    private PCommentDetailMapper commentDetailMapper;
    @Override
    public int insertBatch(List<PCommentDetail> commentDetails) {
        return commentDetailMapper.insertBatch(commentDetails);
    }

    @Override
    public void deleteById(Long commentId) {
        QueryWrapper<PCommentDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("comment_id",commentId);
        commentDetailMapper.delete(queryWrapper);
    }
}
